﻿#region zh-CHS 2006 - 2008 DemoSoft 团队 | en 2006 - 2008 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the MMOSE(Massively Multiplayer Online Server Engine) for .NET.
//
//                              2006-2008 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
using System.Threading;
using Demo.Mmose.Core.Common;
using Demo.Mmose.Core.Map;
using Demo.Mmose.Core.Util;
#endregion

namespace Demo.Mmose.Core.Entity
{
    /// <summary>
    /// 
    /// </summary>
    public sealed class GameEntityState
    {
        #region zh-CHS 共有属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateSerial = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateSerial
        {
            get { return m_UpdateSerial; }
            internal set {m_UpdateSerial = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateX = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateX
        {
            get { return m_UpdateX; }
            internal set { m_UpdateX = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateY = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateY
        {
            get { return m_UpdateY; }
            internal set { m_UpdateY = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateZ = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateZ
        {
            get { return m_UpdateZ; }
            internal set { m_UpdateZ = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateOrientation = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateOrientation
        {
            get { return m_UpdateOrientation; }
            internal set { m_UpdateOrientation = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateLocation = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateLocation
        {
            get { return m_UpdateLocation; }
            internal set { m_UpdateLocation = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateMap = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateMap
        {
            get { return m_UpdateMap; }
            internal set { m_UpdateMap = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateMapSpaceNode = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateMapSpaceNode
        {
            get { return m_UpdateMapSpaceNode; }
            internal set { m_UpdateMapSpaceNode = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateAI = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsUpdateAI
        {
            get { return m_UpdateAI; }
            internal set { m_UpdateAI = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateMoveToCall = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsMoveToCall
        {
            get { return m_UpdateMoveToCall; }
            internal set { m_UpdateMoveToCall = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_UpdateMoveToWorldCall = false;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public bool IsMoveToWorldCall
        {
            get { return m_UpdateMoveToWorldCall; }
            internal set { m_UpdateMoveToWorldCall = value; }
        }

        #endregion

        #region zh-CHS 共有方法 | en Public Methods

        /// <summary>
        /// 
        /// </summary>
        internal void RestoreAll()
        {
            m_UpdateSerial = false;
            m_UpdateX = false;
            m_UpdateY = false;
            m_UpdateZ = false;
            m_UpdateLocation = false;
            m_UpdateOrientation = false;
            m_UpdateMap = false;
            m_UpdateMapSpaceNode = false;
            m_UpdateAI = false;
            m_UpdateMoveToCall = false;
            m_UpdateMoveToWorldCall = false;
        }

        #endregion

        #region zh-CHS 内部的事件处理函数 | en Internal Event Handlers

        #region zh-CHS Serial事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateSerial( Serial serial, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateSerialEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateSerial;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateSerialEventArgs eventArgs = new BeforeUpdateSerialEventArgs( serial, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateSerial( Serial serial, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateSerialEventArgs> tempAfterEventArgs = m_EventAfterUpdateSerial;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateSerialEventArgs eventArgs = new AfterUpdateSerialEventArgs( serial, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS X事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateX( float x, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateXEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateX;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateXEventArgs eventArgs = new BeforeUpdateXEventArgs( x, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateX( float x, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateXEventArgs> tempAfterEventArgs = m_EventAfterUpdateX;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateXEventArgs eventArgs = new AfterUpdateXEventArgs( x, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS Y事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateY( float y, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateYEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateY;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateYEventArgs eventArgs = new BeforeUpdateYEventArgs( y, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateY( float y, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateYEventArgs> tempAfterEventArgs = m_EventAfterUpdateY;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateYEventArgs eventArgs = new AfterUpdateYEventArgs( y, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS Z事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateZ( float z, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateZEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateZ;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateZEventArgs eventArgs = new BeforeUpdateZEventArgs( z, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateZ( float z, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateZEventArgs> tempAfterEventArgs = m_EventAfterUpdateZ;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateZEventArgs eventArgs = new AfterUpdateZEventArgs( z, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS Orientation事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateOrientation( float orientation, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateOrientationEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateOrientation;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateOrientationEventArgs eventArgs = new BeforeUpdateOrientationEventArgs( orientation, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateOrientation( float orientation, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateOrientationEventArgs> tempAfterEventArgs = m_EventAfterUpdateOrientation;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateOrientationEventArgs eventArgs = new AfterUpdateOrientationEventArgs( orientation, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS Location事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeUpdateLocation( Point3D point3D, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateLocationEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateLocation;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateLocationEventArgs eventArgs = new BeforeUpdateLocationEventArgs( point3D, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateLocation( Point3D point3D, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateLocationEventArgs> tempAfterEventArgs = m_EventAfterUpdateLocation;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateLocationEventArgs eventArgs = new AfterUpdateLocationEventArgs( point3D, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS Map事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal void OnBeforeUpdateMap( BaseMap map, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateMapEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateMap;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateMapEventArgs eventArgs = new BeforeUpdateMapEventArgs( map, gameEntity );
                tempBeforeEventArgs( this, eventArgs );
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateMap( BaseMap map, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateMapEventArgs> tempAfterEventArgs = m_EventAfterUpdateMap;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateMapEventArgs eventArgs = new AfterUpdateMapEventArgs( map, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS MapSpaceNode事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal void OnBeforeUpdateMapSpaceNode( MapSpaceNode mapSpaceNode, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateMapSpaceNodeEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateMapSpaceNode;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateMapSpaceNodeEventArgs eventArgs = new BeforeUpdateMapSpaceNodeEventArgs( mapSpaceNode, gameEntity );
                tempBeforeEventArgs( this, eventArgs );
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateMapSpaceNode( MapSpaceNode mapSpaceNode, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateMapSpaceNodeEventArgs> tempAfterEventArgs = m_EventAfterUpdateMapSpaceNode;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateMapSpaceNodeEventArgs eventArgs = new AfterUpdateMapSpaceNodeEventArgs( mapSpaceNode, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS AI事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal void OnBeforeUpdateAI( IArtificialIntelligence artificialIntelligence, GameEntity gameEntity )
        {
            EventHandler<BeforeUpdateAIEventArgs> tempBeforeEventArgs = m_EventBeforeUpdateAI;
            if ( tempBeforeEventArgs != null )
            {
                BeforeUpdateAIEventArgs eventArgs = new BeforeUpdateAIEventArgs( artificialIntelligence, gameEntity );
                tempBeforeEventArgs( this, eventArgs );
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterUpdateAI( IArtificialIntelligence artificialIntelligence, GameEntity gameEntity )
        {
            EventHandler<AfterUpdateAIEventArgs> tempAfterEventArgs = m_EventAfterUpdateAI;
            if ( tempAfterEventArgs != null )
            {
                AfterUpdateAIEventArgs eventArgs = new AfterUpdateAIEventArgs( artificialIntelligence, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS DeleteCall事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal void OnBeforeDeleteCall( GameEntity gameEntity )
        {
            EventHandler<GameEntityEventArgs> tempBeforeEventArgs = m_EventBeforeDeleteCall;
            if ( tempBeforeEventArgs != null )
            {
                GameEntityEventArgs eventArgs = new GameEntityEventArgs( gameEntity );
                tempBeforeEventArgs( this, eventArgs );
            }
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterDeleteCall( GameEntity gameEntity )
        {
            EventHandler<GameEntityEventArgs> tempAfterEventArgs = m_EventAfterDeleteCall;
            if ( tempAfterEventArgs != null )
            {
                GameEntityEventArgs eventArgs = new GameEntityEventArgs( gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS MoveTo事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeMoveTo( Point3D location, GameEntity gameEntity )
        {
            EventHandler<BeforeMoveToCallEventArgs> tempBeforeEventArgs = m_EventBeforeMoveToCall;
            if ( tempBeforeEventArgs != null )
            {
                BeforeMoveToCallEventArgs eventArgs = new BeforeMoveToCallEventArgs( location, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterMoveTo( Point3D location, GameEntity gameEntity )
        {
            EventHandler<AfterMoveToCallEventArgs> tempAfterEventArgs = m_EventAfterMoveToCall;
            if ( tempAfterEventArgs != null )
            {
                AfterMoveToCallEventArgs eventArgs = new AfterMoveToCallEventArgs( location, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #region zh-CHS MoveToWorld事件 | en Public Event
        /// <summary>
        /// 
        /// </summary>
        internal bool OnBeforeMoveToWorld( Point3D newLocation, BaseMap newMap, GameEntity gameEntity )
        {
            EventHandler<BeforeMoveToWorldEventArgs> tempBeforeEventArgs = m_EventBeforeMoveToWorld;
            if ( tempBeforeEventArgs != null )
            {
                BeforeMoveToWorldEventArgs eventArgs = new BeforeMoveToWorldEventArgs( newLocation, newMap, gameEntity );
                tempBeforeEventArgs( this, eventArgs );

                return eventArgs.IsCancel;
            }

            return false;
        }

        /// <summary>
        /// 
        /// </summary>
        internal void OnAfterMoveToWorld( Point3D oldLocation, BaseMap oldMap, GameEntity gameEntity )
        {
            EventHandler<AfterMoveToWorldEventArgs> tempAfterEventArgs = m_EventAfterMoveToWorld;
            if ( tempAfterEventArgs != null )
            {
                AfterMoveToWorldEventArgs eventArgs = new AfterMoveToWorldEventArgs( oldLocation, oldMap, gameEntity );
                tempAfterEventArgs( this, eventArgs );
            }
        }
        #endregion

        #endregion

        #region zh-CHS 共有事件 | en Public Event

        #region zh-CHS Serial事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateSerialEventArgs> m_EventBeforeUpdateSerial;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateSerial = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateSerialEventArgs> BeforeUpdateSerial
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateSerial );
                {
                    m_EventBeforeUpdateSerial += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateSerial );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateSerial );
                {
                    m_EventBeforeUpdateSerial -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateSerial );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateSerialEventArgs> m_EventAfterUpdateSerial;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateSerial = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateSerialEventArgs> AfterUpdateSerial
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateSerial );
                {
                    m_EventAfterUpdateSerial += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateSerial );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateSerial );
                {
                    m_EventAfterUpdateSerial -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateSerial );
            }
        }
        #endregion

        #region zh-CHS X事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateXEventArgs> m_EventBeforeUpdateX;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateX = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateXEventArgs> BeforeUpdateX
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateX );
                {
                    m_EventBeforeUpdateX += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateX );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateX );
                {
                    m_EventBeforeUpdateX -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateX );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateXEventArgs> m_EventAfterUpdateX;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateX = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateXEventArgs> AfterUpdateX
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateX );
                {
                    m_EventAfterUpdateX += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateX );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateX );
                {
                    m_EventAfterUpdateX -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateX );
            }
        }
        #endregion

        #region zh-CHS Y事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateYEventArgs> m_EventBeforeUpdateY;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateY = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateYEventArgs> BeforeUpdateY
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateY );
                {
                    m_EventBeforeUpdateY += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateY );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateY );
                {
                    m_EventBeforeUpdateY -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateY );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateYEventArgs> m_EventAfterUpdateY;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateY = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateYEventArgs> AfterUpdateY
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateY );
                {
                    m_EventAfterUpdateY += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateY );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateY );
                {
                    m_EventAfterUpdateY -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateY );
            }
        }
        #endregion

        #region zh-CHS Z事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateZEventArgs> m_EventBeforeUpdateZ;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateZ = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateZEventArgs> BeforeUpdateZ
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateZ );
                {
                    m_EventBeforeUpdateZ += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateZ );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateZ );
                {
                    m_EventBeforeUpdateZ -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateZ );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateZEventArgs> m_EventAfterUpdateZ;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateZ = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateZEventArgs> AfterUpdateZ
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateZ );
                {
                    m_EventAfterUpdateZ += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateZ );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateZ );
                {
                    m_EventAfterUpdateZ -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateZ );
            }
        }
        #endregion

        #region zh-CHS Orientation事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateOrientationEventArgs> m_EventBeforeUpdateOrientation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateOrientation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateOrientationEventArgs> BeforeUpdateOrientation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateOrientation );
                {
                    m_EventBeforeUpdateOrientation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateOrientation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateOrientation );
                {
                    m_EventBeforeUpdateOrientation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateOrientation );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateOrientationEventArgs> m_EventAfterUpdateOrientation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateOrientation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateOrientationEventArgs> AfterUpdateOrientation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateOrientation );
                {
                    m_EventAfterUpdateOrientation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateOrientation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateOrientation );
                {
                    m_EventAfterUpdateOrientation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateOrientation );
            }
        }
        #endregion

        #region zh-CHS Location事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateLocationEventArgs> m_EventBeforeUpdateLocation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateLocation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateLocationEventArgs> BeforeUpdateLocation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateLocation );
                {
                    m_EventBeforeUpdateLocation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateLocation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateLocation );
                {
                    m_EventBeforeUpdateLocation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateLocation );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateLocationEventArgs> m_EventAfterUpdateLocation;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateLocation = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateLocationEventArgs> AfterUpdateLocation
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateLocation );
                {
                    m_EventAfterUpdateLocation += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateLocation );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateLocation );
                {
                    m_EventAfterUpdateLocation -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateLocation );
            }
        }
        #endregion

        #region zh-CHS Map事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateMapEventArgs> m_EventBeforeUpdateMap;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateMap = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateMapEventArgs> BeforeUpdateMap
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateMap );
                {
                    m_EventBeforeUpdateMap += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateMap );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateMap );
                {
                    m_EventBeforeUpdateMap -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateMap );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateMapEventArgs> m_EventAfterUpdateMap;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateMap = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateMapEventArgs> AfterUpdateMap
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateMap );
                {
                    m_EventAfterUpdateMap += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateMap );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateMap );
                {
                    m_EventAfterUpdateMap -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateMap );
            }
        }
        #endregion

        #region zh-CHS MapSpaceNode事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateMapSpaceNodeEventArgs> m_EventBeforeUpdateMapSpaceNode;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateMapSpaceNode = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateMapSpaceNodeEventArgs> BeforeUpdateMapSpaceNode
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateMapSpaceNode );
                {
                    m_EventBeforeUpdateMapSpaceNode += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateMapSpaceNode );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateMapSpaceNode );
                {
                    m_EventBeforeUpdateMapSpaceNode -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateMapSpaceNode );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateMapSpaceNodeEventArgs> m_EventAfterUpdateMapSpaceNode;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateMapSpaceNode = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateMapSpaceNodeEventArgs> AfterUpdateMapSpaceNode
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateMapSpaceNode );
                {
                    m_EventAfterUpdateMapSpaceNode += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateMapSpaceNode );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateMapSpaceNode );
                {
                    m_EventAfterUpdateMapSpaceNode -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateMapSpaceNode );
            }
        }
        #endregion

        #region zh-CHS AI事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeUpdateAIEventArgs> m_EventBeforeUpdateAI;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeUpdateAI = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeUpdateAIEventArgs> BeforeUpdateAI
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateAI );
                {
                    m_EventBeforeUpdateAI += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateAI );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeUpdateAI );
                {
                    m_EventBeforeUpdateAI -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeUpdateAI );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterUpdateAIEventArgs> m_EventAfterUpdateAI;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterUpdateAI = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterUpdateAIEventArgs> AfterUpdateAI
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateAI );
                {
                    m_EventAfterUpdateAI += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateAI );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterUpdateAI );
                {
                    m_EventAfterUpdateAI -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterUpdateAI );
            }
        }
        #endregion

        #region zh-CHS DeleteCall事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<GameEntityEventArgs> m_EventBeforeDeleteCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeDeleteCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<GameEntityEventArgs> BeforeDeleteCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeDeleteCall );
                {
                    m_EventBeforeDeleteCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeDeleteCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeDeleteCall );
                {
                    m_EventBeforeDeleteCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeDeleteCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<GameEntityEventArgs> m_EventAfterDeleteCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterDeleteCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<GameEntityEventArgs> AfterDeleteCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterDeleteCall );
                {
                    m_EventAfterDeleteCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterDeleteCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterDeleteCall );
                {
                    m_EventAfterDeleteCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterDeleteCall );
            }
        }
        #endregion

        #region zh-CHS MoveTo事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeMoveToCallEventArgs> m_EventBeforeMoveToCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeMoveToCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeMoveToCallEventArgs> BeforeMoveToCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeMoveToCall );
                {
                    m_EventBeforeMoveToCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeMoveToCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeMoveToCall );
                {
                    m_EventBeforeMoveToCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeMoveToCall );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterMoveToCallEventArgs> m_EventAfterMoveToCall;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterMoveToCall = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterMoveToCallEventArgs> AfterMoveToCall
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterMoveToCall );
                {
                    m_EventAfterMoveToCall += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterMoveToCall );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterMoveToCall );
                {
                    m_EventAfterMoveToCall -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterMoveToCall );
            }
        }
        #endregion

        #region zh-CHS MoveToWorld事件 | en Public Event
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<BeforeMoveToWorldEventArgs> m_EventBeforeMoveToWorld;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventBeforeMoveToWorld = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<BeforeMoveToWorldEventArgs> BeforeMoveToWorld
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeMoveToWorld );
                {
                    m_EventBeforeMoveToWorld += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeMoveToWorld );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventBeforeMoveToWorld );
                {
                    m_EventBeforeMoveToWorld -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventBeforeMoveToWorld );
            }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private EventHandler<AfterMoveToWorldEventArgs> m_EventAfterMoveToWorld;
        /// <summary>
        /// 
        /// </summary>
        private ReaderWriterLockSlim m_LockEventAfterMoveToWorld = new ReaderWriterLockSlim();
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public event EventHandler<AfterMoveToWorldEventArgs> AfterMoveToWorld
        {
            add
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterMoveToWorld );
                {
                    m_EventAfterMoveToWorld += value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterMoveToWorld );
            }
            remove
            {
                ReaderWriterLockSlimEx.EnterWriteLock( m_LockEventAfterMoveToWorld );
                {
                    m_EventAfterMoveToWorld -= value;
                }
                ReaderWriterLockSlimEx.ExitWriteLock( m_LockEventAfterMoveToWorld );
            }
        }
        #endregion

        #endregion
    }
}
#endregion